package org.mikeliu.exp4.exp9;

import java.util.Collections;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main 
{
	public static void main(String[] args) 
	{
		Set<Integer> set1=new HashSet<>(),set2=new HashSet<>();
		Scanner scanner=new Scanner(System.in);
		for(int i=0;i<3;i++)
		{
			set1.add(scanner.nextInt());
		}
		for(int i=0;i<3;i++)
		{
			set2.add(scanner.nextInt());
		}
		set1.retainAll(set2);
		System.out.println(set1.size());
	}
}
